{% extends "base.html" %}
{% block content %}


{% if repository.pending_restart %}
{% set message = "You need to restart (and potentially reconfigure) Home Assistant, for your last operation to be loaded." %}
{% endif %}

{% if repository.information.category == "integration" and repository.status.first_install and repository.status.installed and repository.config_flow %}
{% set message = "
  <b>Good news!</b></br>
  This integration supports config flows!</br>
  This means that you can go to 'Configuration' --> 'Integrations' --> '+' to configure it.</br>
  The best part if you do that, is that you do <b>not</b> need to restart Home Assistant.</br></br>
  <i>You may need to clear the cache on the integrations page before it shows in the list (+).</i>"%}
{% endif %}


{% if message %}
{% include 'message.html' with context %}
{% endif %}


<div class='hacs-overview-container'>
  <div class="row">
    <div class="col s12">
      <div class="card hacscolor">
        <div class="card-content">
          <span class="card-title">
            <b>{{repository.display_name}}</b>
            <a class='dropdown-trigger btn right' href='#' data-target='dropdown1'
              style="background-color: var(--primary-color); padding-top: 8px; height: 48px">
              <i class="fas fa-bars"></i>
            </a>

            {% include 'repository/menu.html' with context %}
          </span>
          <p>{{repository.information.description}}</p></br>
          <table class="hacs-table">
            {% if repository.status.installed %}
            <tr class="hacs-table-row repository">
              <td class="repository">
                <b>Installed {{repository.display_version_or_commit}}:</b>
              </td>
              <td class="repository text">
                {{repository.display_installed_version}}
              </td>
              {% endif %}
            </tr>
            <tr class="hacs-table-row repository">
              {% if repository.releases.published_tags %}
              {% include 'repository/versionselect.html' with context %}
              {% else %}
              <td class="repository">
                <b>Available {{repository.display_version_or_commit}}:</b>
              </td>
              <td class="repository text">
                {{repository.display_available_version}}
              </td>
              {% endif %}
            </tr>
            {% if repository.status.selected_tag == repository.information.default_branch %}
            <tr class="hacs-table-row repository">
              <td class="repository">
                <b>Last updated:</b>
              </td>
              <td class="repository text">
                {{repository.information.last_updated}}
              </td>
            </tr>
            {% endif %}
            {% include 'repository/authors.html' with context %}
          </table>
        </div>
        {% include 'repository/buttons.html' with context %}
      </div>
    </div>
  </div>
</div>

<div class='hacs-overview-container'>
  <div class="row">
    <div class="col s12">
      <div class="card hacscolor">
        <div class="card-content" style="margin-top: -20px;">
          {{ repository.information.additional_info }}
          {% include 'repository/note.html' with context %}
        </div>
      </div>
    </div>
  </div>
</div>
{% endblock %}